package com.newlink.building.userinfo.mvp.model

import com.newlink.building.common_base.base.BaseModel
import com.newlink.building.common_base.http.Base_RetrofitHelper
import com.newlink.building.common_base.model.bean.HttpResult
import com.newlink.building.common_base.model.bean.MessageCountRequest
import com.newlink.building.common_base.model.bean.MessageReadResult
import com.newlink.building.common_base.model.bean.PolicyAgreementData
import com.newlink.building.common_base.model.bean.UserInfoData
import com.newlink.building.userinfo.mvp.contract.Module_UserInfo_PersonalContract
import io.reactivex.Observable

/**
 * @author wangyang
 * @date 2022/9/16
 * @description 我的页面的Model
 */
class Module_UserInfo_PersonalModel : BaseModel(), Module_UserInfo_PersonalContract.Model {

    override fun getUserInfo(token: String, userId: Long): Observable<HttpResult<UserInfoData>> {
//        return RetrofitHelper.service.getUserInfo(token, userId)
        return Base_RetrofitHelper.service.getUserInfo(token, userId)
    }

    override fun getUnreadFlag(
        token: String,
        type: Int
    ): Observable<HttpResult<MessageReadResult>> {
        return Base_RetrofitHelper.service.getUnreadFlag(token, type)
    }

    override fun getNoticeUnreadCount(token: String, type: Int): Observable<HttpResult<Int>> {
        return Base_RetrofitHelper.service.getNoticeUnreadFlag(token, type)
    }

    override fun logout(token: String): Observable<HttpResult<Boolean>> {
        return Base_RetrofitHelper.service.logout(token)
    }

    override fun getLocalUnread(request: MessageCountRequest) {
//        KcpTaskHelper.instance.requestMessageCount(request)
    }

    override fun getAgreement(): Observable<HttpResult<PolicyAgreementData>> {
        return Base_RetrofitHelper.xLinkService.getAgreement()
    }

    override fun getFAQ(): Observable<HttpResult<String?>> {
        return Base_RetrofitHelper.xLinkService.getFAQ()
    }
}